/*

This master do file runs all data preparation and analysis. 

*/

version 15
clear all
set more off

** set globals
// make sure this is the correct path 
global cwd  : pwd
global data_folder "$cwd/data/"
global tex_folder "$cwd/outputs/"

global endesData "$data_folder/endesData/" 
global enahoData "$data_folder/enahoData/" 



** clean data 

* clean covid
do "$cwd/clean_covid/clean_covid.do"

* create shift share 
do "$cwd/create_shift_share/create_shift_share.do"

* Clean Endes surveys
do "$cwd/clean_endes_files/clean_endes.do"

*Clean our household survey
do "$cwd/clean_survey/cleaning_survey.do"

*prepare some data for descriptive table
do "$cwd/prepare_data_for_descriptives.do"

* Create synthetic weights. You need to check the path is ok in the R file 
! Rscript getting_synth_weights.R

** merge data 
do "$cwd/merging_files.do"



** Generate outputs
* Create descriptive tables. 
do create_descriptive_tables.do

* create main tables used in analysiss
do create_main_tables.do

* create tables for recall bias check. 
do recall_bias_check.do

*create pre-trend figure 
do pre_trend_figure.do

* For table A1, use the excel file "$tex_folder/changes_employment_sector_v2.xlsx" which is generated in 
* create_shift_share/0_clean_enahos.do



